package com.easy.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.sql.Date;
import java.text.SimpleDateFormat;

@Data
public class UserBean implements Serializable {
    private static final long serialVersionUID = 1L;//序列化版本号
    private String user_name;
    private String user_id;
    private Integer user_age;
    private String user_phone;
    private String user_home;
    private String pet_name;
    private String pet_id;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date adopt_date;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date foster_date;
    private int id;
    private byte state;
    private String user_code;
    public String getAdopt_date(){
        if(adopt_date==null) return null;
        return new SimpleDateFormat("YYYY-MM-dd").format(adopt_date);
    }
    public String getFoster_date(){
        if(foster_date==null) return null;
        return new SimpleDateFormat("YYYY-MM-dd").format(foster_date);
    }
}
